<?php
/**
 * @Author: xuzhiyi
 * @Date:   2016-02-16 20:57:18
 * @Last Modified by:   xuzhiyi
 * @Last Modified time: 2016-02-19 22:11:34
 * ------------------------------------------------ *
 * 银行管理                                         *
 * ------------------------------------------------ */

namespace Admin\Controller;
class BanksController extends CommonController {

	public function index(){
		if(IS_AJAX){
			switch(I('ajax')){
				
				case "addBanks":
					$a = D('Banks')->addBanks();
					if($a){
						$this->success('银行添加成功！','',true);	
					}
					$this->error('银行添加失败！','',true);
					break;
				case "delBanks":
					$status = D('Banks')->delBanks();
					$this->ajaxReturn($status);
					break;
				case "editBanks":
					$a = D('Banks')->editBanks();
					if($a){
						$this->success('银行修改成功！','',true);	
					}
					$this->error('银行修改失败！','',true);
					break;
				default:
					$a=M('banks');
			 		$result = $a->where('bankFlag!=-1')->select();
			 		$output['data'] = $result;
			 		$this->ajaxReturn($output);

			}
		}

		$this->display();
	}
}

